<template>
  <view class="page">
    <view class="flex" v-if="isShowSelectWay">
      <view class="select_way" :class="select_way_num == 1 ? 'select_way_in' : ''" @click="hanldeSelectIn(1)">{{i18n['商家配送']}}</view>
      <view class="select_way " :class="select_way_num == 2 ? 'select_way_in' : ''" @click="hanldeSelectIn(2)">{{i18n['用户自取']}}</view>
    </view>
    <!-- 商家配送 -->
    <view class="address address_1" :class="addressData ? 'bg' : ''" v-if="select_way_num == 1" @click="chooseAddress">
      <block v-if="addressData">
        <image class="address-img" v-if="addressData" :src="imgWechatUrl+'/order/address.png'" mode="widthFix"></image>
        <!-- 没有头像时 做占位符 -->
        <view class="head" v-else></view>
        <!-- 配送地址 -->
        <view class="address-box" v-if="select_way_num == 1">
          <view class="p1">
            <view class="label" v-if="addressData.label_name">{{ addressData.label_name }}</view>
            <view class="text1 text-cut">
              {{ addressData.name }} (
              <text v-if="addressData.sex == 1">{{ i18n['先生'] }}</text>
              <text v-else>{{ i18n['女士'] }}</text>
              )
            </view>
            <view class="text2 text22">{{ addressData && addressData.mobile | filterMobile }}</view>
          </view>
          <view class="p2">{{ addressData.province }}{{ addressData.city }}{{ addressData.district }}{{ addressData.address }}</view>
        </view>
        <image class="to-icon" :src="imgWechatUrl+'/order/right.png'" mode=""></image>
      </block>
      <block v-else>
        <view class="flex justify-center align-center address-empty">
          <image class="address-img" :src="imgWechatUrl+'/order/address.png'" mode="widthFix"></image>
          <view class="no-address">{{ i18n['添加收货地址'] }}</view>
        </view>
      </block>
    </view>

    <view class="body_top" v-else>
      <view class="address address_2" @click="choosePersonInvite">
        <image class="head" :src="imgWechatUrl+'/order/address_3.png'" mode=""></image>
        <view class="address-box">
          <view class="p1" v-if="select_invite_person">
            <view class="text1">{{ select_invite_person.name }}</view>
            <view class="text2">{{ select_invite_person && select_invite_person.mobile | filterMobile }}</view>
          </view>
          <view class="no-address" v-else>{{ i18n['您还没有选泽自取人,去选择'] }}</view>
        </view>
        <image class="to-icon" :src="imgWechatUrl+'/order/right.png'" mode=""></image>
      </view>

      <view class="address address_2 solid-top" @click="chooseAddressInvite">
        <image class="head" :src="imgWechatUrl+'/order/address_2.png'" mode=""></image>
        <view class="address-box">
          <view class="p2" v-if="select_take_address">{{ select_take_address.full_address }}</view>
          <view class="no-address" v-if="!select_take_address">{{ i18n['您还没有选中自取点,去选择'] }}</view>
        </view>
        <image class="to-icon" :src="imgWechatUrl+'/order/right.png'" mode=""></image>
      </view>
      <view class="goods-info solid-top other_box">
        <view class="info-box" style="width:620rpx;">
          <view class="info-item">
            <view class="item-left text">{{ i18n['选择自取时间'] }}</view>
            <view @tap="showTimeList = true" class="item-right">
              <view class="coupon-text">
                <text class="text-666" v-if="timeItem.name">{{ timeItem.name }}</text>
                <text class="margin-left-sm text-666" v-if="dayItem.date_name && timeItem.name">({{ dayItem.date_name }})</text>
                <text v-else>{{ i18n['请选择'] }}</text>
              </view>
              <image class="icon" :src="imgWechatUrl+'/order/right.png'" mode=""></image>
            </view>
          </view>
        </view>
      </view>
    </view>
    <!-- 地址 end -->
    <!-- 商品信息 -->
    <view class="goods-info">
      <view class="goods-box">
        <view class="good-item" v-for="(item, index) in goods" :key="index">
          <view class="img-box"><image class="img" :src="item.thumb" mode="widthFix"></image></view>
          <view class="right-info">
            <view class="">
              <view class="title">{{ item.name }}</view>
              <view class="sku">{{ item.key_name || '' }}</view>
            </view>
            <view class="price-box">
              <view class="price text-prices" v-if="dataSource == 1">
                <text class="text-osd">{{ item.sales_integral }}</text>
                <text class="text-sm margin-left-xs">{{ i18n['积分'] }}</text>
                <text v-if="!item.is_pure_integral" class="padding-left-xs padding-right-xs">+</text>
                <text class="small">￥</text>
                {{ item | filterGoodsPrice }}
              </view>
              <view class="price text-prices" v-else>
                <text class="small">￥</text>
                {{ item | filterGoodsPrice }}
              </view>
              <view class="num">x{{ item.number }}</view>
            </view>
          </view>
        </view>
      </view>
      <view class="info-box">
        <!-- 积分抵扣规则 start -->
        <view class="info-item" v-if="integral_reduce.is_integral_reduce == 1 && order_type == 3">
          <view class="">
            <text class="text-333 text-bold">{{ i18n['积分抵扣'] }}</text>
            <text class="cuIcon-question" @click="couponModel = true"></text>
          </view>
          <view class="action  text-df" @tap="selectUseIntegral">
            <text v-if="!integral_reduce.isSelect" class="text-df margin-right-sm">{{ i18n['共'] }}{{ integral_reduce.score }}{{ i18n['积分'] }}</text>
            <text v-if="integral_reduce.isSelect" class="text-df fu-cred">-¥{{ integral_reduce.reduce_money || 0 }}</text>
            <text v-if="integral_reduce.is_integral_reduce == 1" class="icon cuIcon-right"></text>
          </view>
        </view>
        <!-- 积分抵扣规则 end -->
        <view class="info-item">
          <view class="item-left">
            <view class="text">{{ i18n['商品总额'] }}</view>
          </view>
          <view class="item-right">
            <text v-if="dataSource == 1">
              <text class=" text-df ">{{ sales_integral }}</text>
              <text>{{ i18n['积分'] }}</text>
              <text v-if="!is_pure_integral" class="padding-left-xs padding-right-xs">+</text>
              <text v-if="!is_pure_integral" class="text-price">{{ goods_price }}</text>
            </text>
            <text v-else>
              <text class="text-price">{{ goods_price }}</text>
            </text>
          </view>
        </view>
        <view class="info-item" v-if="dataSource != 1 && coupon_list.length > 0">
          <view class="item-left">
            <view class="text">{{ i18n['优惠券'] }}</view>
          </view>
          <view @tap="getCouponList()" class="item-right">
            <view class="coupon-text coupon-money" v-if="curCoupon">{{ i18n['优惠'] }}{{ curCoupon ? curCoupon.money : '0' }}{{ i18n['元'] }}</view>
            <view class="coupon-text" v-else>{{ i18n['选择优惠券'] }}</view>
            <image class="icon" :src="imgWechatUrl+'/order/right.png'" mode=""></image>
          </view>
        </view>
				<!-- 发票相关 -->
        <!-- <view class="info-item">
          <view class="item-left">
            <view class="text">{{ i18n['发票'] }}</view>
          </view>
          <view @tap="openInvoice" class="item-right">
            <view class="coupon-text" v-if="isInvoice == 2">{{ i18n['不开发票'] }}</view>
            <view class="coupon-text" v-else>{{ invoice.invoice_type == 1 ? i18n['个人发票'] : i18n['企业发票'] }}</view>
            <image class="icon" src="../../static/right.png" mode="aspectFit"></image>
          </view>
        </view> -->
        <view @tap="showFreight = true" v-if="select_way_num == 1" class="info-item">
          <view class="item-left">
            <view class="text">{{ i18n['运费'] }}</view>
          </view>
          <view class="item-right" v-if="express_price || !express_price">
            <view>{{ !express_price ? i18n['包邮'] : `￥${express_price}` }}</view>
            <!-- <image class="icon" src="../../static/right.png" mode="aspectFit" style="margin-left: 16rpx;"></image> -->
          </view>
        </view>
        <view class="info-item">
          <view class="item-left item-left-ipt">
            <view class="text">{{ i18n['留言'] }}</view>
            <input class="fu-fs28 wn90 padding-left text-666" placeholder-class="text-bf" type="text" v-model="remark" maxlength="60" :placeholder="i18n['建议留言前先与商家沟通确认']" />
          </view>
          <view class="item-right"></view>
        </view>
        <!-- 预售相关 start -->
        <view class="margin-top-sm bg-white radius-20 overHidden" v-if="order_type == 7">
          <view class="cu-list menu sm-border">
            <view class="info-item">
              <view class="content">
                <text class="text-666">{{ i18n['阶段1'] }}:&nbsp;&nbsp;{{ i18n['定金'] }}</text>
              </view>
              <view class="action text-bold">
                <text class="text-price">{{ deposit }}</text>
              </view>
            </view>
            <view class="info-item">
              <view class="content">
                <text class="text-666">{{ i18n['阶段2'] }}:&nbsp;&nbsp;{{ i18n['尾款'] }}</text>
              </view>
              <view class="action">
                <view class="text-right text-price text-bold">{{ balance }}</view>
                <view class="text-sm text-cut">{{ presell_stime }} - {{ presell_etime }}{{ i18n['支付尾款'] }}</view>
              </view>
            </view>
            <view class="info-item">
              <view class="content">
                <view class="text-df">{{ i18n['同意支付定金'] }}</view>
                <view class="text-xs">{{ i18n['预售商品,定金不退哦'] }}</view>
              </view>
              <view class="action">
                <!-- <switch :class="agreePayDeposit ? 'checked-green' : ''" @change="changeAgreePayDeposit"
									:checked="agreePayDeposit ? true : false"></switch> -->
                <switch :class="agreePayDeposit ? 'checked' : ''" @change="changeAgreePayDeposit" class="theme" :checked="agreePayDeposit ? true : false"></switch>
              </view>
            </view>
          </view>
        </view>
        <!-- 预售相关 end -->
        <view class="info-footer">
          <text class="text1">{{ i18n['共'] }}{{ number }}{{ i18n['件'] }} {{ i18n['合计'] }}:</text>
          <text class="text2 text-prices" v-if="dataSource == 1">
            <text class="text-bold text-df ">{{ sales_integral }}</text>
            <text class="text-bold text-df ">{{ i18n['积分'] }}</text>
            <text v-if="!is_pure_integral || express_price" class="padding-left-xs padding-right-xs">+</text>
            <text v-if="!is_pure_integral || express_price" class="text-bold text-df text-price"></text>
            <text v-if="!is_pure_integral || express_price" class="text-bold ">{{ payable_money }}</text>
          </text>
          <text class="text2 text-prices" v-else>
            <text class="text-bold text-df text-price"></text>
            <text class="text-bold ">{{ integral_reduce.isSelect ? integral_reduce.integral_payable_money : payable_money }}</text>
          </text>
        </view>
      </view>
    </view>
    <!-- 商品信息 end -->

    <!-- 底部总计和按钮 -->
    <view class="footer-box">
      <view class="left">
        <text class="text1">{{ i18n['总计'] }}：</text>
        <text class="text2 text-prices" v-if="dataSource == 1">
          <text class="text-bold text-df ">{{ sales_integral }}</text>
          <text class="text-bold text-df ">{{ i18n['积分'] }}</text>
          <text v-if="!is_pure_integral || express_price" class="padding-left-xs padding-right-xs">+</text>
          <text v-if="!is_pure_integral || express_price" class="text-bold text-df text-price"></text>
          <text v-if="!is_pure_integral || express_price" class="text-bold ">{{ payable_money }}</text>
        </text>
        <text class="text2 text-prices" v-else>
          <text class="text-bold text-df text-price"></text>
          <text class="text-bold ">{{ integral_reduce.isSelect ? integral_reduce.integral_payable_money : payable_money }}</text>
        </text>
      </view>
      <view class="right_bth" @click="beforeSubmit">{{ i18n['提交订单'] }}</view>
    </view>
    <!-- 底部总计和按钮 end -->
    <!-- 积分兑换弹框 start -->
    <fu-integral-deduction ref="integral" :info="integral_reduce" @hanldeSelect="hanldeSelect"></fu-integral-deduction>
    <!-- 积分兑换弹框 end -->
    <!-- 积分规则 start -->
    <fu-popup ref="coupon" mode="center" border-radius="8" width="550rpx" height="700rpx" :mask-close-able="true" v-model="couponModel" @close="handleClose">
      <view class="rule-box">
        <view class="rule-box-title solid-bottom">{{ i18n['积分使用规则'] }}</view>
        <scroll-view class="rule-box-content" scroll-y>
          <jyf-parser :html="text"></jyf-parser>
          <!-- 此处还没有写接口 -->
        </scroll-view>
        <view class="rule-box-close solid-top" @click="handleClose">{{ i18n['关闭'] }}</view>
      </view>
    </fu-popup>
    <!-- 积分规则 end -->
    <!-- 运费弹窗 start -->
    <fu-popup v-model="showFreight" mode="bottom" z-index="100" :safe-area-inset-bottom="true" :border-radius="24" ref="popupInvoice" @close="closeshowDrawer">
      <view class="freight-popup-content">
        <view class="flex justify-between padding-bottom padding">
          <view class="">
            <view class="close-box"><text class="cuIcon-close text-white"></text></view>
          </view>
          <view class="couponTitle flex-sub flex justify-center align-center">
            <image :src="imgWechatUrl+'/order/pop-title-left.png'" mode="widthFix" class="image margin-right-sm" />
            <view class=" text-center">{{ i18n['运费说明'] }}</view>
            <image :src="imgWechatUrl+'/order/pop-title-right.png'" mode="widthFix" class="image margin-left-sm" />
          </view>
          <view class="close-box" @tap="showFreight = false"><text class="cuIcon-close"></text></view>
        </view>
        <view class="text-333 text-lg text-weight-500 freight-text-title">
          {{ i18n['运费说明'] }}
        </view>
        <view v-if="goods && goods[0] && goods[0].freight_explain" class="freight-text" v-html="goods[0].freight_explain.replace(/\n/g, '<br/>')"></view>
        <view v-else class="freight-text">{{ i18n['无'] }}</view>
        <view  class="freight-submit-btn" @click="showFreight = false">{{ i18n['确定'] }}</view>
      </view>
    </fu-popup>
    <!-- 运费弹窗 end -->
    <!-- 优惠券弹窗 start -->
    <fu-popup v-model="showCoupon" mode="bottom" z-index="100" :safe-area-inset-bottom="true" :border-radius="24" ref="popupInvoice" @close="closeshowDrawer">
      <view class="coupon-popup-content">
        <view class="flex justify-between padding-bottom padding">
          <view class="flex-sub text-center couponTitle flex justify-center align-center">
            <image :src="imgWechatUrl+'/order/pop-title-left.png'" mode="widthFix" class="image margin-right-sm" />
            <view>{{ i18n['优惠'] }}</view>
            <image :src="imgWechatUrl+'/order/pop-title-right.png'" mode="widthFix" class="image margin-left-sm" />
          </view>
          <view class="close-box" @tap="showCoupon = false"><text class="cuIcon-close"></text></view>
        </view>
        <view class="coupon-wrap-scroll">
          <scroll-view class="fu-tab max-520" scroll-y>
            <view class="coupon-wrap" v-if="coupon_list.length > 0">
              <view class="coupon flex " v-for="(item, index) in coupon_list" :key="item.id" @click="choose(item, index)">
                <view class="left flex flex-direction justify-center align-center">
                  <view class="money text-cut">
                    <text class="text-price text-lg"></text>
                    {{ item.money }}
                  </view>
                  <!-- <view class="text-sm" v-if="item.type == 1">{{i18n['使用限制：无限制']}}</view> -->
                  <view class="text-sm  text-cut">{{ i18n['满'] }}{{ item.min_order_money }}{{ i18n['可减'] }}</view>
                </view>
                <view class="center flex flex-direction justify-around solid-top solid-bottom">
                  <view class="text-df text-333 text-cut text-bold coupon-title ">
                    <text >{{ item.name }}</text>
                  </view>
                  <view class="text-999 text-sm text-weight-400">{{ item.content }}</view>
                  <view>
                    <text class="text-cut text-sm text-666 text-weight-400">{{ i18n['有效期至'] }}：{{ item.end_time }}</text>
                  </view>
                </view>
                <view class="_right">
                  <text v-if="!item.checked">{{ i18n['立即使用'] }}</text>
                  <text v-if="item.checked">{{ i18n['已选择'] }}</text>
                </view>
              </view>
            </view>
            <!-- 无数据 start -->
            <view class="kong flex flex-direction justify-center align-center" v-else><fu-empty-ui :pagingListNoListDataText="i18n['暂无可用优惠券']"></fu-empty-ui></view>
          </scroll-view>
        </view>
        <!-- 底部 start -->
        <!-- <button type="warn" class="coupon-submit-btn" @click="showCoupon = false">
          {{i18n['确定']}}
        </button> -->
        <!-- 底部 end -->
      </view>

      <!-- 无数据 end -->
    </fu-popup>
    <!-- 优惠券弹窗 end -->
    <!-- 自取时间弹框 -->
    <fu-popup v-model="showTimeList" mode="bottom" z-index="100" :safe-area-inset-bottom="true" :border-radius="24" ref="popupInvoice" @close="closeshowDrawer">
      <view class="coupon-popup-content">
        <view class="flex justify-between padding-bottom padding solid-bottom">
          <view class="flex-sub text-left">{{ i18n['选择时间'] }}</view>
          <view class="close-box" @tap="showTimeList = false"><text class="cuIcon-close"></text></view>
        </view>
        <!--    左侧分类 start -->
        <view style="height:500rpx" class="content">
          <scroll-view class="left" scroll-y>
            <block v-for="(item, index) in periodList" :key="index">
              <view class="item-wrap" :class="{ 'prev-wrap': dayItem.date_name == item.date_name, 'next-wrap': index == currentIndex + 1 }">
                <view
                  class="item text-center text-cut"
                  :class="{ active: dayItem.date_name == item.date_name, prev: index == currentIndex - 1, next: index == currentIndex + 1 }"
                  @click="handleSelectTimeLeft(item, index)"
                >
                  {{ item.date_name }}
                </view>
              </view>
            </block>
          </scroll-view>
          <!--    左侧分类 end -->
          <!--    右侧分类 start-->
          <view class="right">
            <picker-view v-if="timeOptions.length > 0" @change="bindChange" class="picker-view">
              <picker-view-column>
                <view class="picker_item" v-for="(item, index) in timeOptions" :key="index">{{ item.name }}</view>
              </picker-view-column>
            </picker-view>
            <view v-else class="page-kong padding-tb"><view style="width:100%;text-align: center;margin-top: 50rpx;" class="margin-top-sm  text-999">{{i18n['暂无时间范围点']}}</view></view>
          </view>
          <!--      右侧分类 end -->
        </view>
        <button class="submit-btn text-white" @click="showTimeList = false">{{ i18n['确定'] }}</button>
        <!-- 底部 end -->
      </view>
      <!-- 无数据 end -->
    </fu-popup>
    <!-- 自取时间弹框 end -->
    <!-- 不在配送范围内商品弹框 start -->
	<fu-popup ref="list_fail_goods" mode="center" border-radius="8" :mask-close-able="false" v-model="list_fail_goods_popup"
	>
	<view class="model-notice-box bg-white radius">
		<view class="header text-333 text-bold ">{{i18n['抱歉，以下商品无法下单购买']}}</view>
		<view class="content1  coupon-wrap-scroll">
			<view class="goods_fail_list">
				<view v-for='(item,index) in goods_fail_list'>
					<view class="item flex">
					<view class="img-box">
						<view class="img" >
					      <view class="no-stok" v-if="!item.stock">
                <image class="no-stock-img" :src="imgWechatUrl+'/order/no.png'" mode=""></image>
              </view>
						  <fu-image  :src="item.thumb" mode="aspectFill" ></fu-image>
						</view>
            </view>
					<!-- 商品详细信息 -->
					<view class="info-box" >
						<view class="info-top">
						<view class="title text-cut" >{{ item.name }}</view>
						<view class=" text-sm text-999 key_name " v-if="item.key_name">
							<view class="overFlow_text text-cut">
              <text>{{ item.key_name }}</text>
              </view>
						</view>

						</view>
						<view class="price-box flex justify-between text-sm">
						<view class="price">
							<text class="small">￥</text>
							{{item | filterGoodsPrice}}
            </view>
            <view class="num">x{{ item.number }}</view>
						</view>
					</view>
				</view>	
					<view class="padding-left-sm">{{item.reason}}</view>
				</view>
			</view>
		</view>
		<view class="flex justify-center bottom">
			<view @click.stop="handleCloseFailGoods" class="bottom_content_1 text-theme cu-tag round text-white margin-right">{{i18n['更改收货地址']}}</view>
			<view @click="back" class="bottom_content cu-tag round text-white bg-theme">{{i18n['返回上一页']}}</view>
		</view>
	</view>
</fu-popup>
	<!-- 不在配送范围内商品弹框 end -->
  </view>
</template>

<script>
import fuInvoice from '../../components/fu-invoice/fu-invoice.vue';
import fuIntegralDeduction from '../../components/fu-integral-deduction/index.vue';
// 高德地图sdk
import amapFile from './libs/amap-wx.js';
export default {
  components: {
    fuInvoice,
    fuIntegralDeduction
  },
  data() {
    return {
      list_fail_goods_popup:false,
			imgWechatUrl:this.imgWechatUrl,
				goods_fail_list:[],
      text: '', // 积分使用规则
      couponModel: false, //积分使用规格
      dataSource: 0, // 1积分兑换过来的 0不是
      integral_reduce: {
        is_integral_reduce: 0, //是否存在积分规则 0 不是 1是
        isSelect: false //积分弹框
      },

      is_pure_integral: 0, //是否为纯积分兑换 0 不是 1是
      sales_integral: 0, //商品积分兑换量
      goods: [], //商品信息
      addressData: null, //地址信息
      goods_price: 0, //商品价格
      express_price: 0, //是否存在运费价格
      payable_money: 0, //实付金额
      remark: '', //留言
      order: {}, //订单信息
      coupon: null, //优惠券信息
	  coupon_info:{}, //优惠券信息
      use_not_coupon: 1, // 1未使用优惠券 0 使用了优惠券
      coupon_id: 0, //优惠券id
      curIndex: -1, //当前选中优惠券下标  默认不选中
      coupon_list: [], //优惠券列表
      cartData: null, //购物车信息
      shipping_coupon: null, //购物车优惠券信息
      order_type: 3, //订单类型 7预售
      agreePayDeposit: false, //预售不退款协议是否同意  默认不同意
      deposit: 0, //预售定金
      balance: 0, //预售尾款
      presell_etime: '', //预售支付尾款最后时间
      presell_stime: '', //预售支付尾款开始时间
      isOpen: 1, //打开发票弹窗选择开不开发票
      isInvoice: 2, //默认不开发票
      show: false, //发票开启弹窗
      showFreight: false, //运费开启弹窗
      showCoupon: false, // 优惠券开启弹窗
      invoice: {
        //填写的发票信息
        invoice_type: 1, //1个人2企业
        invoice_title: "", //抬头
        invoice_company_duty_paragraph: "", //税号
        invoice_mobile: "", //联系方式
        invoice_email: "", //电子邮件
        invoice_is_default: "1", //默认抬头
      },
      select_way_num: 1, //用来选择配送方式，1是为商家，2自取
      select_take_address: null, //自取点信息
      select_invite_person: null, //自取人信息
      periodList: [], //自取时间列表 日期
      timeOptions: [], //自取时间列表 时间段
      timeItem: {}, //选择时间对象
      dayItem: {}, //选择日期对象
      reservePhone: '', //预留电话
      showTimeList: false, //自取时间弹框
      currentIndex: 0, //左侧分类选中项下标
      currentList: [], //右侧分类数据
      isShowSelectWay: false,
      location: {}, //当前位置
			isLoading: false, // 防抖 替换原有防抖方法
    };
  },
  filters: {
    /**
     * @description 手机号过滤中间四位用*代替
     * @param {Number,String} val 手机号
     */
    filterMobile(val) {
      if (!val) return '';
      return val.substr(0, 3) + '****' + val.substr(-4);
    }
  },
  /**
   * @description onload接收参数
   * @param {Object} options 入参
   */
	async onLoad(options) {
		/* 有自提时打开注释
		await this.getPostIsOpenInvite();
		this.getTimeList();
		*/
    // 初始化高德地图SDK,记得换成自己的key
    let location = this.$store.state.location;
    this.myAmapFun = new amapFile.AMapWX({
      key: '71e2d1e8fad67225279e724ff7c51e64'
    });
    // 定位功能
    if (!location || !location.district) {
      // 初始化高德地图SDK,记得换成自己的key

      this.autoGetLocation();
    } else {
      this.location = location;
      this.handleSearch();
    }

    this.setNavigationBarTitle(this.i18n['确认订单']);
    // dataSource是否是积分过来 1是 0 undefined否 type == card是购物车过来 ids购物车商品id
    const { dataSource, type, ids } = options;
    this.dataSource = dataSource;
    // 地址id
    if (options.address_id) {
      this.addressData = {
        address_id: options.address_id
      };
    }
    if (type == 'cart' && ids) {
      this.cartData = options;
      // 获取购物车过来订单详情
      this.get_cart_order_info();
    } else {
      this.order = options;
      //非购物车进来订单详情
      this.get_one_order_info();
    }
    // 接收选择地址信息
    uni.$on('select_address', data => {
      this.addressData = data;
      if (this.cartData) {
        this.get_cart_order_info();
      } else {
        this.get_one_order_info();
      }
    });
    // 接收选择发票信息
    uni.$on('select_invoice', data => {
      if (data) {
        this.invoice = data;
        if (data.invoice_title && data.invoice_mobile) {
          this.isInvoice = 1;
        } else {
          this.isInvoice = 2;
        }
      } else {
        this.isInvoice = 2;
      }
    });
    //接受选取自取点
    uni.$on('select_take_address', data => {
      this.select_take_address = data;
    });

    //接受选取提货人信息
    uni.$on('select_invite_person', data => {
      this.select_invite_person = data;
    });
    // this.getIntegralDeductionRule();
  },
  onUnload() {
    // 关闭监听
    uni.$off('select_address');
    uni.$off('select_coupon');
    uni.$off('select_invoice');
    uni.$off('select_take_address');
    uni.$off('select_invite_person');
  },
  computed: {
    // 选择下标后返回选中优惠券数据
    curCoupon() {
      if (this.curIndex == -1) return null;
      return this.coupon_list[this.curIndex];
    },
		number() {
			let number = 0;
			if (this.goods && this.goods.length > 0) {
				this.goods.forEach(item => {
					number += Number(item.number);
				})
			}
			return number;
		}
		
  },
  methods: {
    back(){
      uni.navigateBack();
    },
    handleCloseFailGoods(){
        this.list_fail_goods_popup = false;
        setTimeout(()=>{
          this.chooseAddress()
        },300)
			},
    // 默认自取点
    handleSearch() {
      let that = this;
      this.$api
        .post(global.apiUrls.getInviteAddress, {
          district_id: 0,
          region_code: this.location.districtCode,
          longitude: this.location.longitude,
          latitude: this.location.longitude
        })
        .then(res => {
          if (res.data.code == 1) {
            let lists = (res.data.data && res.data.data.data) || [];
            if (lists.length > 0) {
              that.select_take_address = lists[0];
            }
          } else {
          }
        });
    },
    /**
     * @func 自动定位
     */
    autoGetLocation() {
      let _this = this;
      uni.getLocation({
        geocode: true,
        success: adr => {
          this.myAmapFun.getRegeo({
            location: adr.longitude + ',' + adr.latitude,
            success: data => {
              //成功回调
              let regeoData = data[0].regeocodeData.addressComponent;
              let province = regeoData.province;
              let city = Array.isArray(regeoData.city) && regeoData.city.length == 0 ? regeoData.province : regeoData.city;
              let district = regeoData.district;
              let addressDesc = data[0].desc;
              let provinceCode = regeoData.adcode.substr(0, 2) + '0000';
              let cityCode = regeoData.adcode.substr(0, 4) + '00';
              let districtCode = regeoData.adcode + '';
              let latitude = data[0].latitude;
              let longitude = data[0].longitude;
              _this.$store.commit('updataLocation', {
                province: province,
                city: city,
                district: district,
                addressDesc: addressDesc,
                provinceCode: provinceCode,
                cityCode: cityCode,
                districtCode: districtCode,
                latitude: latitude,
                longitude: longitude
              });
              _this.location = {
                province: province,
                city: city,
                district: district,
                addressDesc: addressDesc,
                provinceCode: provinceCode,
                cityCode: cityCode,
                districtCode: districtCode,
                latitude: latitude,
                longitude: longitude
              };
              this.handleSearch();
            },
            fail: info => {
              //失败回调
              console.log(info);
            }
          });
        }
      });
    },
    // 判断是否打开了自取模式
    getPostIsOpenInvite() {
      return new Promise(resolve=>{
      const that = this;
      this.$api.post(global.apiUrls.postIsOpenInvite).then(res => {
				if (res.data.code == 1) {
					if (res.data.data.pickup_status == 1) {
						that.isShowSelectWay = true;
						this.select_way_num = 2;
					} else {
						this.select_way_num = 1;
						that.isShowSelectWay = false;
					}
					resolve()
				}
			}).catch(err => {
				console.log('err: ' + JSON.stringify(err));
			});
    })
    },
    // 选择配送方式
    hanldeSelectIn(index) {
      this.select_way_num = index;
      if (this.cartData) {
        // 获取购物车过来订单详情
        this.get_cart_order_info();
      } else {
        //非购物车进来订单详情
        this.get_one_order_info();
      }
    },
    bindChange(e) {
      const val = e.detail.value;
      this.timeItem = this.timeOptions[val];
    },
    handleSelectTimeLeft(item, index) {
      this.timeItem = {};
      this.dayItem = item;
      this.timeOptions = item.list;
			this.timeItem = this.timeOptions[0];
    },
    handleSelectTimeRight(ele) {
      this.timeItem = ele;
    },
    // 选择时间点
    getTimeList() {
      this.$api.post(global.apiUrls.getTimePeriodList).then(res => {
        if (res.data.code == 1) {
          let list = res.data.data;
          this.periodList = list;
          if (list.length > 0 && list[0].list) {
            this.timeOptions = list[0].list;
            this.dayItem = list[0];
            if (list[0].list[0]) {
              this.timeItem = list[0].list[0];
            }
          }
        } else {
          this.$message.error(res.data.msg);
        }
      });
    },
    // 自取功能
    // 选择自取人信息
    choosePersonInvite() {
      this.$urouter.navigateTo({
        url: '/pages/address/invite-list/index',
        params: {
          type: 1,
          id: (this.addressData && this.addressData.address_id) || 0
        }
      });
    },
    //选择自取点
    chooseAddressInvite() {
      this.$urouter.navigateTo({
        url: '/pages/address/get-location/index',
        params: {}
      });
    },

    getIntegralDeductionRule() {
      this.$api
        .post(global.apiUrls.postIntegralRule)
        .then(res => {
          if (res.data.code == 1) {
            this.text = res.data.data.content;
          } else {
            this.$message.info(res.data.msg);
          }
        })
        .catch(err => {
          console.log('err: ' + JSON.stringify(err));
        });
    },
    /**
     * @description 获取优惠券列表数据
     */
    getCouponList(val) {
      if (!val) {
        this.showCoupon = true;
      }
      let cid = this.goods.map(item => item.cid);
      cid = [...new Set(cid)].join(',');
      let all_money = {};
      this.goods.forEach((item, index) => {
        let price = item.shop_price;
        all_money[item.id] = {
          price: price * item.number,
          cid: item.cid
        };
      });
      // let data = {
      // 	order_price: this.goods_price,
      // 	coupon_id: this.coupon_id,
      // 	cid: cid,
      // 	all_money: JSON.stringify(all_money)
      // };
      this.$api
        .post(global.apiUrls.postOrderCanUseCoupon, {
          money: this.coupon_info.moeny,
          category: JSON.stringify(this.coupon_info.category),
          goods: JSON.stringify(this.coupon_info.goods)
        })
        .then(res => {
          // this.isShowLoading = false;
          // uni.stopPullDownRefresh();
          if (res.data.code == 1) {
            this.coupon_list = res.data.data;
            // 初始化默认选中的优惠券
            this.initSelected();
          }
        })
        .catch(err => {
          this.isShowLoading = false;
          uni.stopPullDownRefresh();
        });
    },
    /**
     * @description 初始化默认选中的优惠券
     */
    initSelected() {
      // 如果没有优惠券id传入  默认就没有选中优惠券
      if (!this.coupon_id) return;
      this.coupon_list.forEach((item, index) => {
        if (item.id == this.coupon_id) {
          item.checked = true;
          this.curIndex = index;
        } else {
          item.checked = false;
        }
      });
    },
    /**
     * @description 切换选中
     * @param {Object} item 选中数据
     * @param {Number} idx 选中下标
     */
    choose(item, idx) {
      if (item.checked) {
        item.checked = false;
        this.curIndex = -1;
      } else {
        item.checked = true;
        this.curIndex = idx;
      }
      // this.coupon_list.forEach((ele, index) => {
      //   if (index !== idx) {
      //     ele.checked = false
      //   }
      // });
      if (this.curIndex == -1) {
        this.use_not_coupon = 1;
        this.coupon_id = 0;
      } else {
        this.use_not_coupon = 0;
        this.coupon_id = this.coupon_list[this.curIndex].id;
      }
      if (this.cartData) {
        this.get_cart_order_info();
      } else {
        this.get_one_order_info();
      }
      this.showCoupon = false;
      console.log('this.curIndex: ', this.curIndex, this.coupon_id);
    },
    /**
     * @description 打开发票弹框
     */
    openInvoice() {
      // this.isOpen = 2
      // this.show = true;
      let invoice = JSON.stringify(this.invoice);
      uni.navigateTo({
        url:'/pages/invoice/invoice/apply-invoice/index?type=1&invoice='+invoice
      })
    },
    /**
     * @description 关闭发票弹窗
     */
    closeshowDrawer() {
      this.show = false;
    },
    /**
     * @description 是否同意预售金额不支持退款
     */
    changeAgreePayDeposit() {
      this.agreePayDeposit = !this.agreePayDeposit;
    },
    /**
     * @description 非购物车页面进来获取订单详情
     */
    get_one_order_info() {
      const { goods_id, sku_id, number, activity_id = 0 } = this.order;
      const _data = {
        goods_id: goods_id,
        sku_id: sku_id,
        number: number,
        coupon_id: this.coupon_id || '0',
        address_id: (this.addressData && this.addressData.address_id) || 0,
        activity_id: activity_id,
        send_type: this.select_way_num == 1 ? 0 : 1
      };
      if (this.use_not_coupon == 1) {
        _data.use_not_coupon = 1;
      }
      this.$api.post(global.apiUrls.postBuyNowOrderInfo, _data).then(res => {
        if (res.data.code == 1) {
          let data = res.data.data;
          if (data.address && !Array.isArray(data.address)) {
            this.addressData = data.address;
          }
          if (data.pickup_default && !Array.isArray(data.pickup_default)) {
            this.select_invite_person = data.pickup_default;
          }
          this.goods = data.goods;
          this.coupon = data.coupon ? data.coupon : null;
          if (data.coupon) {
            this.coupon_id = data.coupon.id;
          }
          this.integral_reduce.is_integral_reduce = data.is_integral_reduce;
          this.integral_reduce.reduce_money = data.reduce_money;
          this.integral_reduce.score = data.score;
          this.integral_reduce.integral_reduce = data.integral_reduce;
          this.integral_reduce.integral_payable_money = data.integral_payable_money;

          this.sales_integral = data.sales_integral;
          this.deposit = data.deposit;
          this.balance = data.balance;
          this.presell_etime = data.presell_etime;
          this.presell_stime = data.presell_stime;
          this.goods_price = data.goods_price;
          this.express_price = data.express_price;
          this.payable_money = data.payable_money;
          if (data.order_type) {
            this.order_type = data.order_type;
          }
          if (data.shipping_coupon) {
            this.shipping_coupon = data.shipping_coupon;
          }
					// 获取可用优惠券列表
					if(data.coupon_search){
						this.coupon_info = data.coupon_search
						this.getCouponList(true);
					}
        }else if(res.data.code=="-1"){
					this.$message.info(res.data.msg);
				} else {
          this.$message.info(res.data.msg);
          setTimeout(function() {
            uni.navigateBack();
          }, 800);
        }
        uni.stopPullDownRefresh();
      });
    },
    /**
     * @description 购物车过来获取订单详情
     */
    get_cart_order_info() {
      let data = {
        cart_ids: this.cartData.ids,
        coupon_id: this.coupon_id || '0',
        address_id: (this.addressData && this.addressData.address_id) || 0,
        send_type: this.select_way_num == 1 ? 0 : 1
      };
      if (this.use_not_coupon == 1) {
        data.use_not_coupon = 1;
      }
      this.$api
        .post(global.apiUrls.postCartOrderInfo, data)
        .then(res => {
          if (res.data.code == 1) {
            let data = res.data.data;
            if(data.list_fail.length >0){
								this.list_fail_goods_popup = true
								this.goods_fail_list = data.list_fail
							}
            this.goods = data.goods;
            if (data.address && !Array.isArray(data.address)) {
              this.addressData = data.address;
            }
            this.coupon = res.data.data.coupon ? res.data.data.coupon : null;
            if (res.data.data.coupon) {
              this.coupon_id = res.data.data.coupon.id;
            }
            this.goods_price = res.data.data.order_money;
            this.express_price = res.data.data.express_price;
            this.payable_money = res.data.data.payable_money;
            if (res.data.data.shipping_coupon) {
              this.shipping_coupon = res.data.data.shipping_coupon;
            }
            // 获取可用优惠券列表
            if(data.coupon_search){
			  this.coupon_info = data.coupon_search
			  this.getCouponList(true);
            }
          } else {
            this.$message.info(res.data.msg);
            setTimeout(() => {
              uni.navigateBack();
            }, 800);
          }
          uni.stopPullDownRefresh();
        })
        .catch(err => {
          console.log('err: ' + JSON.stringify(err));
        });
    },
    /**
     * @description 选择地址
     */
    chooseAddress() {
      this.$urouter.navigateTo({
        url: '/pages/address/address-list/index',
        params: {
          type: 1,
          id: (this.addressData && this.addressData.address_id) || 0
        }
      });
    },
    /**
     * @description 去选择优惠券
     */
    chooseCoupon() {
      let cid = this.goods.map(item => item.cid);
      cid = [...new Set(cid)].join(',');
      let all_money = {};
      this.goods.forEach((item, index) => {
        let price = item.shop_price;
        all_money[item.id] = {
          price: price * item.number,
          cid: item.cid
        };
      });
      let data = {
        order_price: this.goods_price,
        coupon_id: this.coupon_id,
        cid: cid,
        all_money: JSON.stringify(all_money)
      };
      this.$urouter.navigateTo({
        url: '/pages/order/order-process/choos_coupon/index',
        params: data
      });
    },
    /**
     * @description 关闭积分使用规格
     */
    handleClose() {
      this.couponModel = false;
    },
    /**
     * @description 打开积分使用规格
     */
    selectUseIntegral() {
      const that = this;
      if (this.integral_reduce.is_integral_reduce == 1) {
        that.$refs['integral'].open();
      }
    },
    /**
     * @description 积分抵扣
     * @param {Boolen} isSelect 是否选择了积分抵扣
     */
    hanldeSelect(isSelect) {
      this.integral_reduce.isSelect = isSelect;
      this.$forceUpdate();
    },
    /**
     * @description 提交订单之前验证
     */
    beforeSubmit() {
      // 地址是否存在
      if (!this.addressData && this.select_way_num == 1) return this.$message.info(this.i18n['请选择可用收货地址']);
      if(this.addressData && this.addressData.is_distribution == 1) return this.$message.info(i18n['抱歉，该地址不在配送范围，请更改地址']);
      if (!this.select_invite_person && this.select_way_num == 2) return this.$message.info(this.i18n['请选择提货人']);
      if (!this.select_take_address && this.select_way_num == 2) return this.$message.info(this.i18n['请选择自取点']);
      if (!this.dayItem.real_date && this.select_way_num == 2) return this.$message.info(this.i18n['请选择自取日期']);
      if (!this.timeItem.id && this.select_way_num == 2) return this.$message.info(this.i18n['请选择自取时间段']);

      // 预售订单 是否同意了预售协议
      if (this.order_type == 7) {
        if (!this.agreePayDeposit) {
          this.$util.showModal({
            title: this.i18n['提示'],
            content: this.i18n['预售商品定金不支持退款,同意后可继续下单.'],
            cancelText: this.i18n['取消'],
            confirmText: this.i18n['确定'],
            success: res => {
              if (res.confirm) {
                this.agreePayDeposit = true;
                this.handleSubmit();
              }
            }
          });
        } else {
          // this.$util.throttle(this.handleSubmit, 2000, true);
          this.handleSubmit();
        }
      } else {
    //     this.$util.throttle(() => {
				// 	console.log('提交订单123123123123');
				// 	this.handleSubmit();
				// }, 2000, true);
        this.handleSubmit();
      }
    },
    /**
     * @description 确认订单 下单
     */
    handleSubmit() {
			if (this.isLoading) return;
			this.isLoading = true;
      const that = this;
      var order_info = {};

      //是否为自取点
      if (this.select_way_num == 1) {
        order_info.address = this.addressData;
        order_info.send_type = 0;
      } else {
        order_info.send_type = 1;
        let sendInfo = {
          user_pickup_id: this.select_invite_person.id, //自取人信息
          pickup_id: this.select_take_address.id, // 自提点ID
          pickup_date: this.dayItem.real_date, //自提日期
          pickup_delivery_time_id: this.timeItem.id //自提时间段id
        };
        order_info.invite_address = sendInfo;
      }

      order_info.goods = this.goods;
      order_info.express_price = this.express_price;
      order_info.remark = this.remark;
      // 判断是否开发票  选择开具发票但是不填写信息 也不开发票
      if (this.isInvoice == 1) {
        order_info.invoice = this.invoice;
      }
      // 活动id
      if (this.order.activity_id != 0) {
        order_info.activity_id = this.order.activity_id;
      }
      var postdata = {
        isSelect_integral_reduce: this.integral_reduce.isSelect ? 1 : 0,
        reduce_money: this.integral_reduce.reduce_money,
        order_type: this.order_type,
        order_money: this.goods_price,
        payable_money: this.integral_reduce.isSelect ? this.integral_reduce.integral_payable_money : this.payable_money,
        coupon_id: this.coupon && this.coupon.id ? this.coupon.id : 0,
        order_info: JSON.stringify(order_info)
      };
      // 购物车下单,达到批发价走批发价
      if (this.cartData) {
        postdata.is_wholesale = 1;
      }
      // 拼团
      if (this.order && this.order.team_id) {
        postdata.group_id = this.order.team_id;
      }
      // 优惠券
      if (this.shipping_coupon) {
        postdata.shipping_coupon = this.shipping_coupon.id;
      }
      // 邀请码
      if (this.order.invite_code) {
        postdata.share_sign = this.order.invite_code;
      }
      this.$api.post(global.apiUrls.postCreateOrder, postdata).then(res => {
        if (res.data.code == 1) {
          this.$message.info(this.i18n['订单提交成功，请支付…']);
          if (this.cartData) {
            uni.$emit('delCartGoods', this.cartData.ids);
          }

          this.$api
            .get(global.apiUrls.getOrderDetail, {
              order_sn: res.data.data.order_sn,
              order_type: this.order_type
            })
            .then(response => {
              if (response.data.data.pay_status == 1) {
                if (that.integral_reduce.isSelect) {
                  //跳转到支付成功
                  setTimeout(() => {
										this.isLoading = false;
                    uni.redirectTo({
                      url: '/pages/order/order-process/pay-success/index',
                      params: {
                        order_sn: res.data.data.order_sn,
                        order_type: that.order_type
                      }
                    });
                  }, 500);
                } else {
                  //跳转到积分成功
                  setTimeout(() => {
										this.isLoading = false;
                    uni.redirectTo({
                      url: '/pages/integral/integralgoods/exchange-success/index',
                      params: {
                        order_sn: res.data.data.order_sn,
                        order_type: that.order_type
                      }
                    });
                  }, 500);
                }
              } else {
                setTimeout(() => {
									this.isLoading = false;
                  this.$urouter.redirectTo({
                    url: '/pages/order/order-process/pay-order/index',
                    params: {
                      order_sn: res.data.data.order_sn,
                      order_type: this.order_type
                    }
                  });
                }, 500);
              }
            });
        } else {
					this.isLoading = false;
          this.$message.info(res.data.msg);
        }
      }).catch(err => {
				this.isLoading = false;
				this.$message.info('服务器错误,请稍后重试');
			});
    }
  },
  onPullDownRefresh() {
    if (this.cartData) {
      this.get_cart_order_info();
    } else {
      this.get_one_order_info();
    }
  }
};
</script>

<style lang="scss" scoped>
.page {
  padding-bottom: 10rpx;
}

.other_box {
  margin: 0rpx auto 30rpx !important;
  padding: 0 10rpx 32rpx !important;
}

.picker-view {
  width: 100%;
  height: 500rpx;
}

.picker_item {
  height: 68rpx;
  line-height: 68rpx;
  align-items: center;
  justify-content: center;
  // text-align: center;
  padding-left: 100rpx;
}

.active-time {
  font-size: 28rpx;
  font-family: PingFang SC;
  font-weight: bold;
  color: #333333;
  opacity: 1;
}

.page {
  .content {
    height: 100vh;
    // padding-top: 200rpx;
    display: flex;

    //左侧分类 start
    .left {
      width: 168rpx;

      min-width: 168rpx;
      // height: 100%;
      height: 500rpx;
      // background: #ffffff;

      .item-wrap {
        background-color: #f8f8f8;
      }

      .prev-wrap {
        border-radius: 0 0 24rpx 0;
      }

      .next-wrap {
        border-radius: 0 24rpx 0 0;
      }

      .item {
        width: 100%;
        height: 100rpx;
        line-height: 100rpx;
        transition: all 0.2s;
        font-size: 24rpx;
      }

      .item.active {
        background-color: #ffffff;
        /* font-size: 32rpx; */
        /* border-radius:24rpx 0 0  24rpx; */
      }

      .item.active1 {
        background-color: #ffffff;
        /* font-size: 32rpx;
        border-radius:0 0 0  24rpx; */
      }

      .item.prev {
        border-radius: 0 0 24rpx 0;
      }

      .item.next {
        border-radius: 0 24rpx 0 0;
      }
    }

    //左侧分类 end
  }
}

//右侧分类 start
.right {
  height: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
  background-color: #ffffff;
}

//右侧分类 end
.select_way {
  margin-top: 30rpx;
  font-size: 28rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #333333;
  background-color: #f8f8f8;
  border: 1rpx solid #f8f8f8;
  padding: 8rpx 32rpx;
  margin-left: 30rpx;
  border-radius: 20rpx;
}

.select_way_in {
  font-size: 28rpx;
  font-family: PingFang SC;
  font-weight: 400;
  color: white;
  border: 1rpx solid $fu-main-color;
  background-color: $fu-main-color;
}

// 地址
.address_1 {
  margin: 24rpx auto 0;
  width: 702rpx;
  padding: 40rpx 20rpx;
  opacity: 1;
  border-radius: 16rpx;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  &.bg {
    background: #fff
      url() -7px
      bottom repeat-x;
    background-size: 90rpx 6rpx;
  }
}

.body_top {
  background: #fff;
  border-radius: 16rpx;
  margin: 24rpx auto 0;
  width: 702rpx;
}

// 地址
.address_2 {
  // padding-top:40rpx;
  width: 702rpx;
  height: 100rpx;
  opacity: 1;

  display: flex;
  align-items: center;
  justify-content: space-between;
}

// 地址

.address {
  .head {
    margin-left: 24rpx;
    display: block;
    width: 32rpx;
    height: 32rpx;
    flex-shrink: 0;
  }

  .address-box {
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 498rpx;
    flex-shrink: 0;

    .p1 {
      display: flex;
      align-items: center;

      .label {
        /* width: 56rpx; */
        padding: 0 10rpx;
        // height: 32rpx;
        background: rgba(105, 139, 255, 0.08);
        border: 1px solid #698bff;
        opacity: 1;
        border-radius: 8rpx;
        text-align: center;
        font-size: 24rpx;
        font-family: PingFang SC;
        font-weight: 500;
        line-height: 32rpx;
        color: #698bff;
        opacity: 1;
        flex-shrink: 0;
      }

      .text1 {
        margin-left: 16rpx;
        font-size: 32rpx;
        font-family: PingFang SC;
        font-weight: bold;
        line-height: 34rpx;
        color: #333333;
        opacity: 1;
      }

      .text2 {
        margin-left: 32rpx;
        font-size: 32rpx;
        font-family: Lato;
        font-weight: 500;
        line-height: 34rpx;
        color: #333333;
        opacity: 1;
        flex-shrink: 0;
      }
    }

    .p2 {
      margin-top: 16rpx;
      font-size: 28rpx;
      font-family: PingFang SC;
      font-weight: 400;
      line-height: 40rpx;
      color: #666666;
      opacity: 1;
      //两行溢出隐藏
      white-space: normal;
      word-break: break-all;
      overflow: hidden;
      text-overflow: ellipsis;
      display: -webkit-box;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
    }

    .no-address {
      color: #999;
      font-size: 24rpx;
    }
  }

  .to-icon {
    margin-right: 40rpx;
    display: block;
    width: 12rpx;
    height: 22rpx;
    flex-shrink: 0;
  }
}

// 商品信息
.goods-info {
  margin: 20rpx auto 122rpx;
  width: 702rpx;
  overflow: hidden;
  background: #ffffff;
  opacity: 1;
  border-radius: 16rpx;

  .goods-box {
    position: relative;
    width: 654rpx;
    margin: 0 auto;
    overflow: hidden;
    border-bottom: 1px solid #eeeeee;
    opacity: 1;
    padding-bottom: 32rpx;
    height: auto;

    .good-item {
      width: 654rpx;
      height: 200rpx;
      margin: 0 auto;
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 32rpx;

      .img-box {
        width: 200rpx;
        height: 200rpx;
        flex-shrink: 0;
        position: relative;
        border-radius: 16rpx;
        overflow: hidden;

        .img {
          position: absolute;
          left: 50%;
          top: 50%;
          transform: translateX(-50%) translateY(-50%);
          width: 200rpx;
        }
      }

      .right-info {
        width: 430rpx;
        height: 200rpx;
        display: flex;
        flex-direction: column;
        justify-content: space-between;

        .title {
          font-size: 28rpx;
          font-family: PingFang SC;
          font-weight: 500;
          line-height: 42rpx;
          color: #333333;
          opacity: 1;
          //两行溢出隐藏
          white-space: normal;
          word-break: break-all;
          overflow: hidden;
          text-overflow: ellipsis;
          display: -webkit-box;
          -webkit-box-orient: vertical;
          -webkit-line-clamp: 2;
        }

        .sku {
          margin-top: 8rpx;
          font-size: 24rpx;
          font-family: PingFang SC;
          font-weight: 400;
          line-height: 33rpx;
          color: #999999;
          opacity: 1;
          //单行溢出隐藏
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          word-break: break-all;
        }

        .price-box {
          width: 100%;
          display: flex;
          justify-content: space-between;
          align-items: center;

          .price {
            font-size: 32rpx;
            font-family: Oswald;
            font-weight: 500;
            line-height: 36rpx;
            // color: $theme;
            opacity: 1;

            .small {
              font-size: 22rpx;
            }
          }

          .num {
            font-size: 24rpx;
            font-family: PingFang SC;
            font-weight: 400;
            line-height: 33rpx;
            color: #999999;
            opacity: 1;
          }
        }
      }
    }
  }

  .info-box {
    width: 654rpx;
    margin:  auto;
    overflow: hidden;

    .info-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 32rpx;

      .item-left-ipt {
        width: 100%;
      }

      .item-left {
        display: flex;
        align-items: center;

        // 商品总额 优惠券 运费
        .text {
          font-size: 28rpx;
          font-family: PingFang SC;
          font-weight: 500;
          line-height: 42rpx;
          color: #333333;
          opacity: 1;
        }

        // 全场满88免运费
        .text2 {
          margin-left: 32rpx;
          font-size: 28rpx;
          font-family: PingFang SC;
          font-weight: 400;
          line-height: 42rpx;
          color: #bfbfbf;
          opacity: 1;
        }

        .ipt {
          padding-left: 32rpx;
          font-size: 28rpx;
          font-family: PingFang SC;
          font-weight: 400;
          line-height: 42rpx;
          color: #bfbfbf;
          opacity: 1;
          width: 90%;
        }
      }

      .item-right {
        display: flex;
        align-items: center;
        font-size: 28rpx;
        font-family: PingFang SC;
        line-height: 42rpx;
        color: #333333;
        opacity: 1;

        .coupon-text {
          margin-right: 16rpx;
          font-size: 28rpx;
          font-family: PingFang SC;
          font-weight: 400;
          line-height: 42rpx;
          color: #bfbfbf;
          opacity: 1;
        }

        .coupon-money {
          background: url($IMG_WECHAT_URL+'/order/choose-coupon-bg.png');
          background-color: #fedcdc;
          // width: 136rpx;
          height: 38rpx;
          line-height: 38rpx;
          background-size: 136rpx 38rpx;
          background-position: center left;
          background-repeat: no-repeat;
          padding-left: 47rpx;
          border-radius: 8rpx;
          // background-size: 100% 100%;
          text-align: right;
          padding-right: 10rpx;
          font-size: 22rpx;
          font-family: PingFang SC;
          font-weight: 500;
          color: #fa2033;
        }

        .icon {
          display: block;
          width: 12rpx;
          height: 24rpx;
          flex-shrink: 0;
        }
      }
    }
  }

  .info-footer {
    width: 654rpx;
    margin: 45rpx auto 32rpx;
    overflow: hidden;
    display: flex;
    justify-content: flex-end;

    .text1 {
      margin-right: 8rpx;
      font-size: 24rpx;
      font-family: PingFang SC;
      font-weight: 500;
      line-height: 42rpx;
      color: #666666;
      opacity: 1;
    }

    .text2 {
      font-size: 32rpx;
      font-family: Oswald;
      font-weight: 500;
      line-height: 36rpx;
      // color: $theme;
      opacity: 1;

      .small {
        font-size: 22rpx;
      }
    }
  }
}

// 底部总计和按钮
.footer-box {
  height: 90rpx;
  height: calc(90rpx + constant(safe-area-inset-bottom));
  height: calc(90rpx + env(safe-area-inset-bottom));
  width: 750rpx;
  left: 0;
  position: fixed;
  bottom: 0 !important;
  z-index: 99;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);

  .left {
    display: flex;
    align-items: center;
    margin-left: 32rpx;

    .text1 {
      font-size: 28rpx;
      font-family: PingFang SC;
      font-weight: 400;
      line-height: 32rpx;
      color: #1a1a1a;
      opacity: 1;
    }

    .text2 {
      font-size: 32rpx;
      font-family: Oswald;
      font-weight: 500;
      line-height: 36rpx;
      // color: $theme;
      opacity: 1;

      .small {
        font-size: 22rpx;
      }
    }
  }

  .right_bth {
    width: 280rpx;
    height: 90rpx;
    background: $bgtheme;
    opacity: 1;
    text-align: center;
    font-size: 32rpx;
    font-family: PingFang SC;
    font-weight: 500;
    line-height: 90rpx;
    color: #ffffff;
    opacity: 1;
  }
}

.freight-popup-content {
  position: relative;
  padding-bottom: 156rpx;
  padding-bottom: calc(156rpx + constant(safe-area-inset-bottom));
  padding-bottom: calc(156rpx + env(safe-area-inset-bottom));
  .freight-title {
    padding-left: 32rpx;
    // width: 128px;
    // height: 45px;
    font-size: 32rpx;
    font-family: PingFang SC;
    font-weight: 500;
    color: #333333;
  }
  .freight-text-title{
    padding: 0 32rpx;
    box-sizing: border-box;
  }
  .freight-text {
    padding: 16rpx 32rpx 0rpx 32rpx;
    // width: 686px;
    // height: 209px;
    font-size: 28rpx;
    font-family: PingFang SC;
    font-weight: 400;
    color: #666666;
  }

  .freight-btn {
    width: 750rpx;
    height: 100rpx;
    background: $bgtheme;
    text-align: center;
    font-size: 32rpx;
    font-family: PingFang SC;
    font-weight: 400;
    line-height: 100rpx;
    color: #ffffff;
  }

  .top-box {
    position: relative;
    padding-top: 40rpx;

    .icon-title {
      width: 32rpx;
      height: 10rpx;
    }

    .title {
      font-size: 36rpx;
      font-family: PingFang SC;
      font-weight: bold;
      color: #333333;
      margin-left: 24rpx;
      margin-right: 24rpx;
    }

    .icon-close {
      position: absolute;
      right: 32rpx;
      top: 50rpx;
      height: 28rpx;
      width: 28rpx;
    }
  }
  .freight-submit-btn{
    width: 100%;
    height: 100rpx;
    background: #F8F8F8;
    font-size: 32rpx;
    font-family: PingFang SC;
    font-weight: 400;
    line-height: 100rpx;
    color: #333333;
    text-align: center;
    position: absolute;
    bottom: 0;
    bottom: calc(0rpx + constant(safe-area-inset-bottom));
    bottom: calc(0rpx + env(safe-area-inset-bottom));
    left: 0;
  }
}

.coupon-popup-content {
  z-index: 100;
  background: linear-gradient(180deg, #ffffff 0%, #f8f8f8 100%);
  .coupon-wrap {
    padding: 0 24rpx;
    box-sizing: border-box;
    .coupon {
      margin-bottom: 24rpx;
      border-radius: 16rpx;
      overflow: hidden;
      height: 200rpx;
      .left {
        width: 196rpx;
        flex-shrink: 0;
        background: #ff6464;
        color: #ffffff;
        .money {
          font-size: 50rpx;
          font-weight: 500;
          line-height: 78rpx;
        }
      }
      .center {
        padding: 0 32rpx;
        box-sizing: border-box;
        background: #ffffff;
        width: calc(100% - 196rpx - 52rpx);
      }
      ._right {
        width: 52rpx;
        line-height: 52rpx;
        background: #ff6464;
        font-size: 24rpx;
        font-weight: 400;
        color: #ffffff;
        text-align: center;
        writing-mode: tb-rl;
        letter-spacing: 10rpx;
      }
    }
  }
}

// 积分弹框 start
.model-notice-box {
  width: 550rpx;

  .header {
    padding: 40rpx;
    height: 50rpx;
    line-height: 50rpx;
    text-align: center;
  }

  .content {
    margin-top: 20rpx;
    width: 90%;
    margin-left: 5%;

    .height-100 {
      line-height: 40rpx;
    }
  }

  .bottom_content {
    margin: 30rpx 0;
    text-align: center;
    width: 200rpx;
    background: $bgtheme;
  }
  .bottom_content_1 {
			margin: 30rpx 0;
			text-align: center;
			width: 200rpx;
			border: 1rpx solid  $bgtheme;
			background: #fff;
		}
}

// 积分弹框 end
/deep/ uni-switch.checked-green .uni-switch-input {
  background-color: #39b54a !important;
  border-color: #39b54a !important;
  color: #ffffff !important;
}

.submit-btn {
  border-radius: 48rpx;
  margin: 50rpx 32rpx;
  height: 80rpx;
  line-height: 80rpx;
  background: $bgtheme !important;
  font-size: 30rpx;
}

/* // 规则弹窗 */
.rule-box {
  width: 100%;
  height: 100%;
  background-color: #0062cc;
  background: linear-gradient(top, #fff, #fff);

  .rule-box-title {
    height: 100rpx;
    font-size: 36rpx;
    line-height: 100rpx;
    text-align: center;
    font-weight: bold;
    color: #3b2204;
  }

  .rule-box-content {
    height: calc(100% - 200rpx);
    color: rgb(51, 51, 51);
    padding: 20rpx;
  }

  .rule-box-close {
    height: 100rpx;
    font-size: 32rpx;
    line-height: 100rpx;
    text-align: center;
    color: rgb(51, 51, 51);
  }
}
.coupon-wrap-scroll {
  max-height: 520rpx;
  overflow: auto;
}
.max-520 {
  max-height: 520rpx;
}
// 2021-5-18 添加  修改优惠券样式
.couponTitle {
  .image {
    width: 32rpx;
    height: 10rpx;
  }
}
.coupon-item {
  height: 45rpx;
  font-size: 32rpx;
  font-family: PingFang SC;
  font-weight: 400;
  line-height: 42rpx;
  color: #333333;
  padding: 0 32rpx;
  box-sizing: border-box;
  margin-bottom: 40rpx;
  &:last-child {
    margin-bottom: 96rpx;
  }
}
.coupon-submit-btn {
  width: 750rpx;
  height: 100rpx;
  line-height: 100rpx;
  background: #f8f8f8;
  font-size: 32rpx;
  font-family: PingFang SC;
  font-weight: 500;
  color: #333333;
  position: relative;
  bottom: 0;
  bottom: calc(0rpx + constant(safe-area-inset-bottom));
  bottom: calc(0rpx + env(safe-area-inset-bottom));
  border: none;
  &::after {
    border: none;
    border-radius: 0;
  }
}
.address-empty {
  width: 100%;
  .no-address {
    font-size: 32rpx;
    font-weight: bold;
    color: #333333;
  }
}
.address-img {
    width: 60rpx;
    height: 60rpx;
    margin-right: 24rpx;
  }

.goods_fail_list{
  margin: 20rpx 0;
// 商品图片
      .img-box {
        width: 110rpx;
        height: 110rpx;
        flex-shrink: 0;
        margin-left: 24rpx;
        overflow: hidden;
        border-radius: 16rpx;
        position: relative;

        .no-stok {
          position: absolute;
          left: 50%;
          top: 50%;
          transform: translateX(-50%) translateY(-50%);
          width: 148rpx;
          height: 148rpx;
          z-index: 2;
          background: rgba(0, 0, 0, 0.4);
          border-radius: 74rpx;

          display: flex;
          align-items: center;
          justify-content: center;

          .no-stock-text {
            color: #fff;
          }

          .no-stock-img {
            display: block;
            width: 95rpx;
            height: 95rpx;
          }
        }

        .img {
          position: absolute;
          left: 0;
          top: 50%;
          transform: translateY(-50%);
          z-index: 1;
          width: 110rpx;
          height: 110rpx;
        }
      }

	  .info-box {
			width: 370rpx;
			margin: 0 auto;
      padding: 0 20rpx;
			overflow: hidden;
			margin-bottom: 40rpx;

			.info-item {
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 40rpx;

				.item-left-ipt {
					width: 100%;
				}

				.item-left {
					display: flex;
					align-items: center;

					// 商品总额 优惠券 运费
					.text {
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 500;
						line-height: 42rpx;
						color: #333333;
						opacity: 1;
					}

					// 全场满88免运费
					.text2 {
						margin-left: 32rpx;
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 400;
						line-height: 42rpx;
						color: #bfbfbf;
						opacity: 1;
					}

					.ipt {
						padding-left: 32rpx;
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 400;
						line-height: 42rpx;
						color: #bfbfbf;
						opacity: 1;
						width: 90%;
					}
				}

				.item-right {
					display: flex;
					align-items: center;

					font-size: 28rpx;
					font-family: PingFang SC;
					font-weight: 500;
					line-height: 42rpx;
					color: #333333;
					opacity: 1;

					.coupon-text {
						margin-right: 16rpx;
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 400;
						line-height: 42rpx;
						color: #bfbfbf;
						opacity: 1;
					}

					.coupon-money {
						background: url($IMG_WECHAT_URL+'/order/choose-coupon-bg.png');
						background-color: #FEDCDC;
						// width: 136rpx;
						height: 38rpx;
						line-height: 38rpx;
						background-size: 136rpx 38rpx;
						background-position: center left;
						background-repeat: no-repeat;
						padding-left: 47rpx;
						border-radius: 8rpx;
						// background-size: 100% 100%;
						text-align: right;
						padding-right: 10rpx;
						font-size: 22rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #FA2033;

					}

					.icon {
						display: block;
						width: 12rpx;
						height: 24rpx;
						flex-shrink: 0;
					}
				}
			}
		}
}

.margin-right{
	margin-right: 30rpx!important;
}
</style>
